<? 
require_once '../includes/includes.php';
include ("seguridad.php");
conexion();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title><?php titulopanel();?></title>
<link rel="STYLESHEET" type="text/css" href="estilo.css">
<link type="text/css" href="../plugins/jquery_ui/css/smoothness/jquery-ui-1.8.13.custom.css" rel="Stylesheet" />   
<script type="text/javascript" src="../plugins/jquery.js"></script>
<link href="../plugins/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../plugins/uploadify/swfobject.js"></script>
<script type="text/javascript" src="../plugins/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
  $('#file_upload').uploadify({
    'uploader'  : '../plugins/uploadify/uploadify.swf',
    'script'    : '../plugins/uploadify/uploadify.php',
    'cancelImg' : '../plugins/uploadify/cancel.png',
    'folder'    : '../images_gallery/',
	'simUploadLimit' : 3,
    'auto'      : true,
	'multi'     : true,	
	'scriptData'  : {'id': $("#id").val()},
	'buttonText': 'Seleccionar', 
  });
});
</script>
<script type="text/javascript" src="../plugins/jquery_ui/js/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="../plugins/jquery_validate/jquery.validate.js"></script>
<script type="text/javascript" src="../plugins/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
 



<!-- EDITOR -->
<?php include_once 'includes/tinymce.html';?>

<!-- /TinyMCE --> 

<!-- datapicker -->
<script> 
	$(document).ready(function(){
		$("#created" ).datepicker({
			dateFormat: 'yy-mm-dd',
			showOn: "button",
			buttonImage: "images/calendar.ico",
			buttonImageOnly: true

				});
	})
</script> 
	
<script>
	$(function() {
		$( "input:submit, a, button", ".boton" ).button();		
	});
</script>	

<!-- Errores jaquery -->



<script>
  $(document).ready(function(){
		
	$("#form").validate({
		rules: {			
			categorie: {
				required: true,
				},
			created: {
				required: true,
				},	
			title: {
				required: true,
					},
			summary: {
				required: true,
				},
			conten: {
					required: true,
					},	
		},		
		                
		messages: {
			categorie: {
				required: "Seleccione una categoria"
				
						},
			created: {
				required: "Seleccione la fecha"
			 			},			

            title:{
                required: "Coloque un título"
                    },
                    
            summary:{
                required:"Coloque un copete"        
                     },        
            conten: "Coloque un cuerpo"		
                    
			}
	});
	
  });

</script>



<?php
if(isset($_POST[submit])){

?>

	<script>
	$(function() {
		$( "#tabs" ).tabs( { selected: 1 } );
	});
	</script>

<?php
}
else{

?>

<script>
	$(function() {
		$( "#tabs" ).tabs( {disabled:[1,2]} );	
		
	});
	

</script>

<?php
}
?>



</head>

<body>

<?php
if(isset($_POST[submit])){


 //
 
 $name = $_POST[name];
 
 $campos = "folder, year, month, is_published, name, description";
 $valores = "'', '', '', 1, '$name', '$description'";
 
 sqlinsert("album", $campos, $valores);

 $consulta = mysql_fetch_array(mysql_query("SELECT MAX(id) as id FROM album "));
 $id = $consulta['id'];
 $_SESSION[id_album] = $id;
	


echo $_SESSION[id_album];

}
?>





<div id="contenedor">

  	<div id="encabezado"><?php include('header.php') ?></div><!--fin de encabezado-->

	<div id="content_center">

	<div id="menuizquierda"><?php include('menu.php') ?></div>	<!--fin de menuizquierda-->

	
	<div id="content">		
	
		<div id="formulario">




		
		
			<br>
			<span class="title">Cargar Galeria</span>
			<br><br>
			
			
			
			
<div class="demo">

<div id="tabs">
	<ul>
		<li><a href="#tabs-1" id="tab">Crear Album</a></li>
		<li><a href="#tabs-2" id="img">Cargar Imagenes</a></li>		
		
	</ul>
	
	<div id="tabs-1">
	
		<form class="admin" id="form" name="form" action="#" method="post" enctype="multipart/form-data">
		<p><span>Publicar:</span>
			<input type="checkbox" name="published" value="1" checked />
		</p>
		<br/>
		
<p><span>Fecha:</span>
			<input type="text" id="created" name="created" value="<?php echo date("Y-m-d")?>" style="width:100px;"/>
			</p>
			
		
		<p><span>Nombre del album</span>
			<input type="text" name="name" <?php
				if(isset($_POST[submit])){
				
				echo 'value="'.$name.'"';
				
				}
			?>		
			/>
		</p>
		<br/>
		
		<p><span>Descripcion</span>
			<input type="text" name="description" <?php
				if(isset($_POST[submit])){
				
				echo 'value="'.$description.'"';
				
				}
			?>		
			/>
		</p>
		<br/>
		
		<br/><br/><br/>
		<input type="submit" class="buttonadmin" value="Crear" style="font-size:12px" name="submit">
		<a class="enlacecancelar" href="noticias.php"><input type="button" class="buttoncancelar" value="Cancelar"></a>
	<br/>
		</form>
	</div>
	
	<div id="tabs-2">
		<input id="file_upload" name="file_upload" type="file" class="buttonadmin"/>
		<input id="id" name="id" type="hidden" value="<?php echo $id ?>" />
		<br/>
		<br/>
		<a class="enlacecancelar" href="galerias.php"><input type="button" class="buttoncancelar" value="Finalizar"></a>
		<a class="enlacecancelar" href="ver_album.php?id=<?php  echo $id ?>"><input type="button" class="buttonadmin" value="Ver"></a>
		
		
	</div>
	
	

	
</div>

</div><!-- End demo -->
		
		
		
			<form class ="admin" id="form" name="form" action="control_noticias.php" method="post" enctype="multipart/form-data">
			<br>
			
			
				
				
				<br>
				
				<br>
				</form>
				<br>
				
	</div><!-- cierre formulario -->
	<br>
	<br>
	</div><!--fin de content-->

</div><!--fin de content center-->
	<div id="piepagina"><?php include 'pie.php'; ?></div>	<!--fin de piepagina-->
</div>

</body>

</html>


